package com.gufe.mapper.admin;


import com.gufe.dto.SysUserDTO;
import com.gufe.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {
    /**
     * 登录验证
     * @param user
     * @return
     */
    @Select("select * from sys_user where password = #{password} and username = #{username}  ")
    SysUser login(SysUserDTO user);

    /**
     * 查询用户角色信息
     * @param id
     * @return
     */
    @Select("select role_id from sys_user_role where user_id = #{id}")
    Integer getInfo(Integer id);

    /**
     * 查询用户角色信息
     *
     * @return
     */
    @Select("SELECT role_id from sys_user_role where user_id = #{userId}")
    default Integer getRoleId() {
        return getRoleId(null);
    }

    /**
     * 查询用户角色信息
     * @param userId
     * @return
     */
    @Select("SELECT role_id from sys_user_role where user_id = #{userId}")
    Integer getRoleId(Integer userId);
}
